// avoid problematic regular rexpressions, e.g. xmapwpt generated [:\n:],
// or one can imagine [0-9] when we meant the characters, '0', '-', and '9',
// or one can imagine [^a] when we meant the characters '^' and 'a'.
- QRegularExpression regex = QRegularExpression(QString("[%1]").arg(QRegularExpression::escape(to_nuke)));
+ QRegularExpression regex = QRegularExpression(QStringLiteral("[%1]").arg(QRegularExpression::escape(to_nuke)));
assert(regex.isValid());
r.remove(regex);
}
QDateTime creation_time = bintime2utc(bindate, bintime);
QString datetime = creation_time.toString("yyyy/MM/dd hh:mm:ss");
*track = new route_head;
- (*track)->rte_name = QString("%1 tracklog (%2)").arg(model->name, datetime);
+ (*track)->rte_name = QStringLiteral("%1 tracklog (%2)").arg(model->name, datetime);
(*track)->rte_desc = "GPS tracklog data";
track_add_head(*track);
}
// second byte is endianness
def.endian = fit_getuint8();
if (def.endian > 1) {
- throw ReaderException(QString("Bad endian field 0x%1 at file position 0x%2.").arg(def.endian, 0, 16).arg(gbftell(fin) - 1, 0, 16).toStdString());
+ throw ReaderException(QStringLiteral("Bad endian field 0x%1 at file position 0x%2.").arg(def.endian, 0, 16).arg(gbftell(fin) - 1, 0, 16).toStdString());
}
fit_data.endian = def.endian;
auto* lappt = new Waypoint;
lappt->latitude = GPS_Math_Semi_To_Deg(endlat);
lappt->longitude = GPS_Math_Semi_To_Deg(endlon);
- lappt->shortname = QString("LAP%1").arg(++lap_ct, 3, 10, QLatin1Char('0'));
+ lappt->shortname = QStringLiteral("LAP%1").arg(++lap_ct, 3, 10, QLatin1Char('0'));
waypt_add(lappt);
}
break;
speed = MPS_TO_KPH(speed);
}
QString base = wpt->shortname.isEmpty() ? "WPT" : wpt->shortname;
- wpt->shortname = base + QString("@%1").arg(speed,0,'f',0);
+ wpt->shortname = base + QStringLiteral("@%1").arg(speed,0,'f',0);
}
}
read_header();
if ((codepage >= 1250) && (codepage <= 1257)) {
- QString qCodecName = QString("windows-%1").arg(codepage);
+ QString qCodecName = QStringLiteral("windows-%1").arg(codepage);
cet_convert_init(CSTR(qCodecName), 1);
} else if (codepage == 65001) {
cet_convert_init("utf8", 1);
codepage = 0;
for (int i = 1250; i <= 1257; i++) {
- if (QString("windows-%1").arg(i).compare(QString(opt_writecodec), Qt::CaseInsensitive) == 0) {
+ if (QStringLiteral("windows-%1").arg(i).compare(QString(opt_writecodec), Qt::CaseInsensitive) == 0) {
codepage = i;
break;
}
gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format)
{
if ((garmin_format == GDB) && (icon >= 500) && (icon <= 563)) {
- return QString("Custom %1").arg(icon - 500);
+ return QStringLiteral("Custom %1").arg(icon - 500);
}
if ((garmin_format == PCX) && (icon >= 7680) && (icon <= 8191)) {
- return QString("Custom %1").arg(icon - 7680);
+ return QStringLiteral("Custom %1").arg(icon - 7680);
}
for (const icon_mapping_t* i = garmin_icon_table; i->icon; i++) {
unsigned int days = seconds / 86400u;
QString out = "P";
if (days != 0) {
- out.append(QString("D%1").arg(days));
+ out.append(QStringLiteral("D%1").arg(days));
seconds -= 86400u * days;
}
out.append(QString("T"));
unsigned int hours = seconds / 3600u;
if (hours != 0) {
- out.append(QString("%1H").arg(hours));
+ out.append(QStringLiteral("%1H").arg(hours));
seconds -= 3600u * hours;
}
unsigned int minutes = seconds / 60u;
if (minutes != 0) {
- out.append(QString("%1M").arg(minutes));
+ out.append(QStringLiteral("%1M").arg(minutes));
seconds -= 60u * minutes;
}
if (seconds != 0) {
- out.append(QString("%1S").arg(seconds));
+ out.append(QStringLiteral("%1S").arg(seconds));
}
return out;
}
res->description = FREAD_CSTR_AS_QSTR; /* instruction */
if (wpt_class == gt_waypt_class_map_intersection || wpt_class == gt_waypt_class_map_line) {
garmin_fs_t::set_duration(gmsd, duration);
- res->notes = QString("[%1]").arg(gdb_to_ISO8601_duration(duration));
+ res->notes = QStringLiteral("[%1]").arg(gdb_to_ISO8601_duration(duration));
#if GDB_DEBUG
DBG(GDB_DBG_WPTe, 1)
printf(MYNAME "-wpt \"%s\" (%d): duration = %u\n",
fatal(MYNAME ": output file already open.\n");
}
- QString ofname = QString("%1%2%3.gpssim").arg(fnamestr, doing_tracks ? "-track" : "-route").arg(trk_count++, 4, 10, QChar('0'));
+ QString ofname = QStringLiteral("%1%2%3.gpssim").arg(fnamestr, doing_tracks ? "-track" : "-route").arg(trk_count++, 4, 10, QChar('0'));
fout = gbfopen(ofname, "wb", MYNAME);
}
(void) track_recompute(rh);
if (!rte->rte_name.isEmpty()) {
QString name = rte->rte_name.left(kGtcMaxNameLen);
- gtc_write_xml(0, QString("<Name>%1</Name>\n").arg(name));
+ gtc_write_xml(0, QStringLiteral("<Name>%1</Name>\n").arg(name));
} else {
gtc_write_xml(0, "<Name>New Course</Name>\n");
}
void KmlFormat::wr_position_init(const QString& fname)
{
posnfilename = fname;
- posnfilenametmp = QString("%1-").arg(fname);
+ posnfilenametmp = QStringLiteral("%1-").arg(fname);
realtime_positioning = 1;
max_position_points = atoi(opt_max_position_points);
}
if (trackdirection && (pt_type == kmlpt_track)) {
QString value;
if (waypointp->speed < 1) {
- value = QString("%1-none").arg(style);
+ value = QStringLiteral("%1-none").arg(style);
} else {
- value = QString("%1-%2").arg(style)
+ value = QStringLiteral("%1-%2").arg(style)
.arg((int)(waypointp->course / 22.5 + .5) % 16);
}
writer->writeTextElement(QStringLiteral("styleUrl"), value);
break;
}
- return QString("https://www.geocaching.com/images/kml/%1").arg(icon);
+ return QStringLiteral("https://www.geocaching.com/images/kml/%1").arg(icon);
}
const char* KmlFormat::kml_lookup_gc_container(const Waypoint* waypointp)
}
if (0 == rating % 10) {
- star_content = QString("stars%1").arg(rating / 10);
+ star_content = QStringLiteral("stars%1").arg(rating / 10);
} else {
- star_content = QString("stars%1_%2").arg(rating / 10).arg(rating % 10);
+ star_content = QStringLiteral("stars%1_%2").arg(rating / 10).arg(rating % 10);
}
return star_content;
if (trackdirection) {
kml_write_bitmap_style(kmlpt_other, ICON_TRK, "track-none");
for (int i = 0; i < 16; ++i) {
- kml_write_bitmap_style(kmlpt_other, QString(ICON_DIR).arg(i), QString("track-%1").arg(i));
+ kml_write_bitmap_style(kmlpt_other, QStringLiteral(ICON_DIR).arg(i), QStringLiteral("track-%1").arg(i));
}
} else {
kml_write_bitmap_style(kmlpt_track, ICON_TRK, nullptr);
} else if (!trk->rte_desc.isEmpty()) {
name = trk->rte_desc;
} else {
- name = name + QString("Babel %1").arg(trail_count);
+ name = name + QStringLiteral("Babel %1").arg(trail_count);
}
int text_len = name.length();
}
// Didn't find it in table, default to leave it as the number found
- return QString("icon-%1").arg(icon);
+ return QStringLiteral("icon-%1").arg(icon);
}
template <typename T>
if (global_opts.masked_objective& TRKDATAMASK && (trk_head == nullptr || (mtk_info.track_event & MTK_EVT_START))) {
char spds[50];
trk_head = new route_head;
- trk_head->rte_name = QString("track-%1").arg(1 + track_count());
+ trk_head->rte_name = QStringLiteral("track-%1").arg(1 + track_count());
spds[0] = '\0';
if (mtk_info.speed > 0) {
/* Button press -- create waypoint, start count at 1 */
auto* w = new Waypoint(*trk);
- w->shortname = QString("WP%1").arg(waypt_count() + 1, 6, 10, QLatin1Char('0'));
+ w->shortname = QStringLiteral("WP%1").arg(waypt_count() + 1, 6, 10, QLatin1Char('0'));
waypt_add(w);
}
// In theory we would not add the waypoint to the list of
if (retval.isValid() && parts.size() == 2) {
bool ok;
// prepend "0.". prepending "." won't work if there are no trailing digits.
- long msec = lround(1000.0 * QString("0.%1").arg(parts.at(1)).toDouble(&ok));
+ long msec = lround(1000.0 * QStringLiteral("0.%1").arg(parts.at(1)).toDouble(&ok));
if (ok) {
retval = retval.addMSecs(msec);
} else {
const QStringList fields = ibuf.split(',');
if (fields.size() > 4) {
QTime time = nmea_parse_hms(fields[1]);
- QString datestr = QString("%1%2%3").arg(fields[2], fields[3], fields[4]);
+ QString datestr = QStringLiteral("%1%2%3").arg(fields[2], fields[3], fields[4]);
QDate date = QDate::fromString(datestr, "ddMMyyyy");
// The prev_datetime data member might be used by
if (values.contains(key)) {
result = values.value(key)->icon;
} else {
- result = QString("%1:%2").arg(osm_features[ikey], value);
+ result = QStringLiteral("%1:%2").arg(osm_features[ikey], value);
}
return result;
}
{
if (waypointp->creation_time.isValid()) {
double time = (waypt_time(waypointp) / SECONDS_PER_DAY) + DAYS_SINCE_1990;
- return QString("%1").arg(time, 0, 'f', 7);
+ return QStringLiteral("%1").arg(time, 0, 'f', 7);
}
return QString("");
}
QString buff;
if ((track_out_count) && (ozi_objective == trkdata)) {
- buff = QString("-%1").arg(track_out_count);
+ buff = QStringLiteral("-%1").arg(track_out_count);
} else {
buff = QString("");
}
sname.chop(suffix_len + 1);
}
- QString tmpname = QString("%1%2.%3").arg(sname, buff, ozi_extensions[ozi_objective]);
+ QString tmpname = QStringLiteral("%1%2.%3").arg(sname, buff, ozi_extensions[ozi_objective]);
/* re-open file_out with the new filename */
if (stream != nullptr) {
if (qstarz_bl_1000_is_waypoint_type(type)) {
if (global_opts.synthesize_shortnames) {
- waypoint->shortname = QString("WP%2").arg(waypt_count() + 1, 3, 10, QChar('0'));
+ waypoint->shortname = QStringLiteral("WP%2").arg(waypt_count() + 1, 3, 10, QChar('0'));
waypoint->wpt_flags.shortname_is_synthetic = 1;
}
waypt_add(waypoint);
}
if (thisw->shortname.isEmpty()) {
- thisw->shortname = QString("%1-%2").arg(trk->rte_name).arg(tkpt);
+ thisw->shortname = QStringLiteral("%1-%2").arg(trk->rte_name).arg(tkpt);
}
tkpt++;
prev = thisw;
{
auto* wpt = new Waypoint;
- wpt->shortname = QString("TP%1").arg(++st->tpn, 4, 10, QLatin1Char('0'));
+ wpt->shortname = QStringLiteral("TP%1").arg(++st->tpn, 4, 10, QLatin1Char('0'));
wpt->latitude = lat;
wpt->longitude = lon;
track_add_head(track_temp);
/* generate a generic track name */
- track_temp->rte_name = QString("Track %1").arg(i+1);
+ track_temp->rte_name = QStringLiteral("Track %1").arg(i+1);
/* zoom level 1-5 visibility flags */
gbfread(&buff[0], 1, 10, tpo_file_in);
if (tmp) {
styles[ii].name = gbfreadbuf(tmp, tpo_file_in);
} else { // Assign a generic style name
- styles[ii].name = QString("STYLE %1").arg(ii);
+ styles[ii].name = QStringLiteral("STYLE %1").arg(ii);
}
#ifdef Tracks2012
//TBD: Should this be TRACKNAMELENGTH?
Waypoint* waypoint_temp = tpo_convert_ll(lat, lon);
// Assign a generic waypoint name
- waypoint_temp->shortname = QString("NOTE %1").arg(ii + 1);
+ waypoint_temp->shortname = QStringLiteral("NOTE %1").arg(ii + 1);
//UNKNOWN DATA LENGTH
(void)tpo_read_int();
Waypoint* waypoint_temp = tpo_convert_ll(lat, lon);
// Assign a generic waypoint name
- waypoint_temp->shortname = QString("SYM %1").arg(ii + 1);
+ waypoint_temp->shortname = QStringLiteral("SYM %1").arg(ii + 1);
// Add the waypoint to the chain of waypoints
waypt_add(waypoint_temp);
Waypoint* waypoint_temp = tpo_convert_ll(lat, lon);
// Assign a generic waypoint name
- waypoint_temp->shortname = QString("TXT %1").arg(ii + 1);
+ waypoint_temp->shortname = QStringLiteral("TXT %1").arg(ii + 1);
for (int jj = 0; jj < 16; jj++) {
//UNKNOWN DATA LENGTH
strftime(buff, sizeof(buff), opt_title, &tm);
track->rte_name = buff;
} else {
- track->rte_name = QString("%1-%2").arg(opt_title, datetimestring);
+ track->rte_name = QStringLiteral("%1-%2").arg(opt_title, datetimestring);
}
} else if (!track->rte_name.isEmpty()) {
- track->rte_name = QString("%1-%2").arg(track->rte_name, datetimestring);
+ track->rte_name = QStringLiteral("%1-%2").arg(track->rte_name, datetimestring);
} else {
track->rte_name = datetimestring;
}
dest->rte_num = src->rte_num;
/* name in the form TRACKNAME #n */
if (!src->rte_name.isEmpty()) {
- dest->rte_name = QString("%1 #%2").arg(src->rte_name).arg(++trk_seg_num);
+ dest->rte_name = QStringLiteral("%1 #%2").arg(src->rte_name).arg(++trk_seg_num);
}
/* Insert after original track or after last newly
current_trk = new route_head;
track_add_head(current_trk);
if (!rte->rte_name.isEmpty()) {
- current_trk->rte_desc = QString("Generated from route %1").arg(rte->rte_name);
+ current_trk->rte_desc = QStringLiteral("Generated from route %1").arg(rte->rte_name);
current_trk->rte_name = rte->rte_name; /* name the new trk */
}
}
&east, &north, &zone, &zonec, unicsv_datum_idx)) {
unicsv_fatal_outside(wpt);
}
- *fout << QString("%1").arg(zone, 2, 10, QLatin1Char('0')) << unicsv_fieldsep
+ *fout << QStringLiteral("%1").arg(zone, 2, 10, QLatin1Char('0')) << unicsv_fieldsep
<< zonec << unicsv_fieldsep
<< qSetRealNumberPrecision(0) << east << unicsv_fieldsep
<< north;
} else if (!wpt->notes.isNull()) {
wpt->shortname = wpt->notes;
} else {
- wpt->shortname = QString("WPT%1").arg(waypt_count(), 3, 10, QLatin1Char('0'));
+ wpt->shortname = QStringLiteral("WPT%1").arg(waypt_count(), 3, 10, QLatin1Char('0'));
}
}
append(wpt);
if (synth && wpt->shortname.isEmpty()) {
- wpt->shortname = QString("%1%2").arg(namepart).arg(waypt_ct, number_digits, 10, QChar('0'));
+ wpt->shortname = QStringLiteral("%1%2").arg(namepart).arg(waypt_ct, number_digits, 10, QChar('0'));
wpt->wpt_flags.shortname_is_synthetic = 1;
}
}